home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 098 (1990-12)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / XLisp-Stat / Functions / pointproto.lsp < prev    next >
Text File  |  1990-10-11  |  737b  |  27 lines

  1. ; book pp.199-200
  2.  
  3. (defproto point-proto '(x y) '() compound-data-proto)
  4.  
  5. (defmeth point-proto :x (&optional (x nil set))
  6.   (if set (setf (slot-value 'x) x))
  7.   (slot-value 'x))
  8.  
  9. (defmeth point-proto :y (&optional (y nil set))
  10.   (if set (setf (slot-value 'y) y))
  11.   (slot-value 'y))
  12.  
  13. (defmeth point-proto :isnew (x y)
  14.   (send self :x x)
  15.   (send self :y y))
  16.  
  17. (defmeth point-proto :data-length () 2)
  18. (defmeth point-proto :data-seq ()
  19.   (list (send self :x) (send self :y)))
  20. (defmeth point-proto :make-data (seq)
  21.   (send point-proto :new (select seq 0) (select seq 1)))
  22. (defmeth point-proto :print (&optional (stream t))
  23.   (format stream
  24.           "#<a point located at x = ~d and y = ~d>"
  25.           (send self :x)
  26.           (send self :y)))
  27.